import eel
import random
import pathlib
from openpyxl import Workbook
from openpyxl import load_workbook
from inc import *

file=root/pathlib.Path("班级座位.xlsx")
#print (file)
wb = load_workbook(str(file))
wb_active=wb.active
wb_row=wb_active.rows
room={}
for i in range(2,wb_active.max_column+1):   
    #print(wb_active.cell(row=1,column=i).value)
    name=str(getClassNo(str(wb_active.cell(row=1,column=i).value)))
    array=[]
    for n in range(2,wb_active.max_row+1):
        if(wb_active.cell(row=n,column=i).value!=None):
            array.append(wb_active.cell(row=n,column=i).value)

    room[name]=(len(array),array)
print(room)

eel.init('web')


@eel.expose                         # Expose this function to Javascript
def say_hello_py(x):
    print('Hello from %s' % x)
say_hello_py('Python World!')

eel.say_hello_js('Python World!')   # Call a Javascript function

@eel.expose
def te1():
    print("te1")
    eel.say_hello_js('Python World!') 

for i in room:
    eel.addkc(i,getAlias(i)+"考场")
    
@eel.expose
def showkc(kc):
    for i in room[kc]:
        print(i[1])

eel.start('index.html', size=(800, 600))